in-radius

 

in-radius is used when you want to select all agents within a certain radius of the current agent. For example, a turtle might like to know how many other turtles are within two units of itself, or a patch might like to know how many turtles are within three units of itself. You can think of in-radius as a filter that takes some large agentset and filters out all those agents too far away, leaving only those within a given radius.

For example, say you wanted to model air pollution. In the model below, all the patches within a certain radius of a factory are polluted, represented by darkening those patches. By varying the given radius, we can simulate different levels of pollution.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the in-radius primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Similar primitives:
in-cone

reports members of an agentset within a "cone-of-vision" for a turtle

Read more
other

reports an agentset which is the same as the input agentset but omits the agent who is asking for the report

Read more
in-radius

reports members of an agentset within a certain distance of an agent

Read more
neighbors

reports an agentset containing eight neighboring patches

Read more
 
Learn another primitive